#ifndef __spi_hard_oled_h__
#define __spi_hard_oled_h__

#include "gd32f4xx_spi.h"
#include "gd32f4xx.h"
#include "stdlib.h"
#include <stdio.h>
#include "oledfont.h"
#include "systick.h"

#define OLED_CMD 0  // 写命令
#define OLED_DATA 1 // 写数据

#define u8 uint8_t
#define u16 uint16_t
#define u32 uint32_t


#define ISP_CLK_GPIO GPIOA
#define ISP_CLK_PIN GPIO_PIN_5 

#define ISP_MOS_GPIO GPIOA
#define ISP_MOS_PIN GPIO_PIN_7

#define ISP_DC_GPIO GPIOA
#define ISP_DC_PIN GPIO_PIN_2

#define ISP_CS_GPIO GPIOA
#define ISP_CS_PIN GPIO_PIN_3

//-----------------OLED端口定义----------------
#define OLED_DC_Clr() gpio_bit_reset(ISP_DC_GPIO, ISP_DC_PIN) // DC
#define OLED_DC_Set() gpio_bit_set(ISP_DC_GPIO, ISP_DC_PIN)

#define OLED_CS_Clr() gpio_bit_reset(ISP_CS_GPIO, ISP_CS_PIN) // CS
#define OLED_CS_Set() gpio_bit_set(ISP_CS_GPIO, ISP_CS_PIN)

void OLED_ClearPoint_SPI_HARD(u8 x, u8 y);
void OLED_ColorTurn_SPI_HARD(u8 i);
void OLED_DisplayTurn_SPI_HARD(u8 i);
void OLED_WR_Byte_SPI_HARD(u8 dat, u8 mode);
void OLED_DisPlay_On_SPI_HARD(void);
void OLED_DisPlay_Off_SPI_HARD(void);
void OLED_Refresh_SPI_HARD(void);
void OLED_Clear_SPI_HARD(void);
void OLED_DrawPoint_SPI_HARD(u8 x, u8 y, u8 t);
void OLED_DrawLine_SPI_HARD(u8 x1, u8 y1, u8 x2, u8 y2, u8 mode);
void OLED_DrawCircle_SPI_HARD(u8 x, u8 y, u8 r);
void OLED_ShowChar_SPI_HARD(u8 x, u8 y, u8 chr, u8 size1, u8 mode);
void OLED_ShowChar6x8_SPI_HARD(u8 x, u8 y, u8 chr, u8 mode);
void OLED_ShowString_SPI_HARD(u8 x, u8 y, u8 *chr, u8 size1, u8 mode);
void OLED_ShowNum_SPI_HARD(u8 x, u8 y, u32 num, u8 len, u8 size1, u8 mode);
void OLED_ShowChinese_SPI_HARD(u8 x, u8 y, u8 num, u8 size1, u8 mode);
void OLED_ScrollDisplay_SPI_HARD(u8 num, u8 space, u8 mode);
void OLED_ShowPicture_SPI_HARD(u8 x, u8 y, u8 sizex, u8 sizey, u8 BMP[], u8 mode);
void OLED_Init_SPI_HARD(void);

#endif
